package com.lcq.study.jvm.leijiazai;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName DeadLockTest
 * @Description
 * @Author lichuanqi
 * @Date 2022/1/28 17:10
 * @Version 1.0
 **/
public class DeadLockTest {
    public static void main(String[] args) {
        new Thread(()-> DLT_A.test()).start();
        new Thread(()-> DLT_B.test()).start();
    }

}

class DLT_A{
    static {
        System.out.println("DLT_A static code");
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        new DLT_B();
    }

    public static void test(){
        System.out.println("DLT_A test");
    }
}

class DLT_B{
    static {
        System.out.println("DLT_B static code");
        new DLT_A();
    }

    public static void test(){
        System.out.println("DLT_B test");
    }
}
